package com.example.demo.business;

import com.example.demo.account.AccountFeign;
import com.example.demo.order.OrderFeign;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class BusinessServiceImpl implements BusinessService {

    @Autowired
    private AccountFeign accountFeign;

    @Autowired
    private OrderFeign orderFeign;

    @Override
    @GlobalTransactional
    public String work(Map<String, String> param) {

        //账户服务 和  点单服务是微服务
        accountFeign.updateAccount(param);

        orderFeign.updateOrder(param);

        return "SUCCESS";
    }
}
